//
//  BasModel.m
//  KnowEveryThings
//
//  Created by lanou3g on 16/5/7.
//  Copyright © 2016年 王玲. All rights reserved.
//

#import "BasModel.h"
#import "WLModel.h"
#import "WLWLModel.h"
#import "WaModel.h"
@implementation BasModel

+ (instancetype)modelWithDictionay:(NSDictionary *)dictionary {
    NSArray *imageArray = dictionary[@"imgnewextra"];
    switch (imageArray.count) {
        case 0:
        {
            //switch..case 中创建 类 需要加{}
            WLModel *wlModel = [[WLModel alloc]init];
[wlModel setValuesForKeysWithDictionary:dictionary];
            return wlModel;
            break;
        }
            case 2:
        {
            
            WLWLModel *wlwlModel = [[WLWLModel alloc]init];
            [wlwlModel setValuesForKeysWithDictionary:dictionary];
            return wlwlModel;
        }
            break;
            case 3:
        {
            WaModel *aModel = [[WaModel alloc]init];
            [aModel setValuesForKeysWithDictionary:dictionary];
            return aModel;
        }
            break;

        default:
            return nil;
            break;
    }
}
-(void)setValue:(id)value forKey:(NSString *)key
{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"id"]) {
        _ID = value;
    }
}
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}
@end
